// map.js
Page({
  data: {
    latitude: 40.060539,
    longitude: 116.343847,
    // 报修详情数据
    repairInfo: {},
  },
  onLoad({ id }) {
    this.initData(id)
  },
  // 获取报修详情
  async initData(id) {
    const repairInfo = await wx.http.get('/repair/' + id)
    // console.log(res);
    this.setData({ repairInfo })
  },
  // 修改信息跳转
  onEdit() {
    wx.redirectTo({
      url: '/repair_pkg/pages/form/index?id=' + this.data.repairInfo.id,
    })
  },
  // 取消报修
  async test() {
    await wx.http.put('/cancel/repaire/' + this.data.repairInfo.id)
    wx.utils.toast('已取消')
    setTimeout(() => {
      wx.reLaunch({
        url: '/repair_pkg/pages/list/index',
      })
    }, 1000)
  }
})
